package com.xnyzc.lhy.mis.controller.cmsapi.userinfo;

import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.mis.entity.user.UserInfoManage;
import com.xnyzc.lhy.mis.service.cms.userinfo.UserInfoManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 用户信息管理Controller
 *
 * @author zhaolijie
 * @date:2019/08/27
 */
@RestController
@RequestMapping(value = "/cpmapi/userinfo")
public class UserInfoManageController {


    @Autowired
    private UserInfoManageService userInfoService;


    /**
     * 分页获取用户信息
     *
     * @param current
     * @return
     */
    @GetMapping(value = "/getUserInfo")
    public Rv getUserInfo(Integer current) {
        return userInfoService.getUserInfo(current);
    }

    /**
     * 模糊查询获取用户信息
     *
     * @param current:需要查询的页码
     * @param sex:性别,1：男，2：女，3：保密,4:未设置
     * @param isBlocked:0:正常用户;1:黑名单用户;2:用户已注销
     * @param userPhone:手机号码
     * @param userName:用户姓名
     * @return
     */
    @GetMapping(value = "/getUserInfoLike")
    public Rv getUserInfoLike(Integer current, String sex, String isBlocked, String userPhone, String userName,String officeId) {
        return userInfoService.getUserInfoLike(current, sex, isBlocked, userPhone, userName,officeId);
    }

    /**
     * 获取数据导出Excel数据
     * @return
     */
    @GetMapping(value = "/exportExcelUserInfo")
    public Rv exportExcelUserInfo() {
        return userInfoService.exportExcelUserInfo();
    }


    /**
     * 新增用户信息
     * @return
     */
    @PostMapping(value = "/addUserInfo")
    public Rv addUserInfo(@RequestBody  UserInfoManage userInfoManage) {
        return userInfoService.addUserInfo(userInfoManage);
    }


    /**
     * 获取用户详情
     * @return
     */
    @GetMapping(value = "/getUserInfoDetails")
    public Rv getUserInfoDetails(Long userId) {
        return userInfoService.getUserInfoDetails(userId);
    }

    /**
     * 修改用户信息
     * @return
     */
    @PostMapping(value = "/updateUserInfo")
    public Rv updateUserInfo(@RequestBody  UserInfoManage userInfoManage) {
        return userInfoService.updateUserInfo(userInfoManage);
    }


    /**
     * 获取部门信息
     * @return
     */
    @GetMapping(value = "/getOfficeInfo")
    public Rv getOfficeInfo() {
        return userInfoService.getOfficeInfo();
    }



}
